# 作者: 菅世博
# 2025年02月20日15时28分32秒
# 512326042@qq.com


class Animal:  # 基类

    def __init__(self, name, color):  # 初始化方法
        self.name = name

    def eat(self):
        print(f'{self.name}eat')

    def run(self):
        print(f'{self.name}run')

    def sleep(self):
        print(f'{self.name}sleep')

    def drink(self):
        print(f'{self.name}drink')


class Dog(Animal):  # 单继承 #若要多继承，则需要在括号中添加多个基类
    def __init__(self, name, color):
        super().__init__(name, color)
        self.color = color

    def bark(self):
        print(f'{self.name}bark')

class xiaotianquan(Dog):
    weapon = '大招'
    def __init__(self, name, color, weapon):
        super().__init__(name, color)
        self.weapon = weapon

    def fly(self):
        print(f'{self.name}fly') # 子类可以访问父类的方法


if __name__ == '__main__':
    dog = Dog('大黄','yellow')
    print(dog.name)
    print(dog.color)
    print(xiaotianquan.weapon)